﻿using WH.Model.Bases;
using WH.Common.Bases.IBase;
using SqlSugar;

namespace WH.Model.Systems
{
    ///<summary>
    ///机构信息表
    ///</summary>
    [SugarTable("sys_organization")]
    public class OrganizationEntity : BaseEntity, ISoftFilter
    {
        /// <summary>
        /// 父节点id 默认为0位顶节点
        /// </summary>
        [SugarColumn(ColumnName = "parent_id", IsNullable = true, Length = 50, ColumnDescription = "父节点id 默认为0位顶节点")]
        public string? ParentId { get; set; }

        /// <summary>
        /// 层次 例如 0级 1级 2级 3级 用数字代替
        /// </summary>
        [SugarColumn(ColumnName = "layer", IsNullable = false, Length = 11, ColumnDescription = "层次 例如 0级 1级 2级 3级 用数字代替")]
        public int Layer { get; set; }

        /// <summary>
        /// 完整链路路径
        /// </summary>
        [SugarColumn(ColumnName = "link", IsNullable = true, Length = 255, ColumnDescription = "完整链路路径")]
        public string? Link { get; set; }

        /// <summary>
        /// 是否为叶子节点
        /// </summary>
        [SugarColumn(ColumnName = "is_leaf", IsNullable = true, Length = 1, ColumnDescription = "是否为叶子节点")]
        public bool IsLeaf { get; set; }

        /// <summary>
        /// 编码 例如SHPDXC00001
        /// </summary>
        [SugarColumn(ColumnName = "code", IsNullable = false, Length = 50, ColumnDescription = "编码 例如SHPDXC00001")]
        public string Code { get; set; } = null!;

        /// <summary>
        /// 名称 例如 上海新晨养老院
        /// </summary>
        [SugarColumn(ColumnName = "name", IsNullable = false, Length = 50, ColumnDescription = "名称")]
        public string Name { get; set; } = null!;

        /// <summary>
        /// 排序码 数字越小越靠前
        /// </summary>
        [SugarColumn(ColumnName = "sort_code", IsNullable = true, Length = 11, ColumnDescription = "排序码 数字越小越靠前")]
        public int SortCode { get; set; }

        /// <summary>
        /// 状态（0停用 1正常）
        /// </summary>
        [SugarColumn(ColumnName = "is_enable", IsNullable = true, Length = 1, ColumnDescription = "状态（0停用 1正常）")]
        public bool IsEnable { get; set; }

        /// <summary>
        /// 状态（0停用 1正常）
        /// </summary>
        [SugarColumn(ColumnName = "is_delete", IsNullable = true, Length = 1, ColumnDescription = "状态（0停用 1正常）", DefaultValue = "0")]
        public bool IsDelete { get; set; }

        /// <summary>
        /// 描述/备注说明
        /// </summary>
        [SugarColumn(ColumnName = "remark", IsNullable = true, Length = 255, ColumnDescription = "描述/备注说明")]
        public string? Remark { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        [SugarColumn(ColumnName = "created_by", IsNullable = true, Length = 50, ColumnDescription = "创建人")]
        public virtual string? CreatedBy { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [SugarColumn(ColumnName = "created_time", IsNullable = true, ColumnDescription = "创建时间")]
        public virtual DateTime CreatedTime { get; set; }

        /// <summary>
        /// 修改人
        /// </summary>
        [SugarColumn(ColumnName = "updated_by", IsNullable = true, Length = 50, ColumnDescription = "修改人")]
        public virtual string? UpdatedBy { get; set; }

        /// <summary>
        /// 修改时间
        /// </summary>
        [SugarColumn(ColumnName = "updated_time", IsNullable = true, ColumnDescription = "修改时间")]
        public virtual DateTime UpdatedTime { get; set; }


        /// <summary>
        /// 负责人姓名
        /// </summary>
        [SugarColumn(ColumnName = "manager_name", IsNullable = true, ColumnDescription = "负责人姓名")]
        public string? ManagerName { get; set; }

        /// <summary>
        /// 负责人手机号码
        /// </summary>
        [SugarColumn(ColumnName = "manager_phone", IsNullable = true, ColumnDescription = "负责人联系方式")]
        public string? ManagerPhone { get; set; }

        /// <summary>
        /// 负责人微信
        /// </summary>
        [SugarColumn(ColumnName = "manager_weixin", IsNullable = true, ColumnDescription = "负责人微信")]
        public string? ManagerWeiXin { get; set; }

        /// <summary>
        /// 负责人固话
        /// </summary>
        [SugarColumn(ColumnName = "manager_tel", IsNullable = true, ColumnDescription = "负责人固话")]
        public string? ManagerTel { get; set; }

        /// <summary>
        /// 负责人邮箱
        /// </summary>
        [SugarColumn(ColumnName = "manager_email", IsNullable = true, ColumnDescription = "负责人邮箱")]
        public string? ManagerEmail { get; set; }

        /// <summary>
        /// 负责人传真
        /// </summary>
        [SugarColumn(ColumnName = "manager_fax", IsNullable = true, ColumnDescription = "负责人传真")]
        public string? ManagerFax { get; set; }

        /// <summary>
        /// 机构联系地址
        /// </summary>
        [SugarColumn(ColumnName = "contact_address", IsNullable = true, ColumnDescription = "机构联系地址")]
        public string? ContactAddress { get; set; }

        /// <summary>
        /// 机构图片
        /// </summary>
        [SugarColumn(ColumnName = "image_url", IsNullable = true, ColumnDescription = "机构图片")]
        public string? ImageUrl { get; set; }

        /// <summary>
        /// 邮编
        /// </summary>
        [SugarColumn(ColumnName = "postal_code", IsNullable = true, ColumnDescription = "邮编")]
        public string? PostalCode { get; set; }

        /// <summary>
        /// 机构类型编号
        /// </summary>
        [SugarColumn(ColumnName = "type_code", IsNullable = false, ColumnDescription = "机构类型编号")]
        public string TypeCode { get; set; } = null!;

        /// <summary>
        /// 类型
        /// </summary>
        //[Navigate(NavigateType.OneToOne, nameof(TypeCode), nameof(KeyValueEntity.Code))]
        [SugarColumn(IsIgnore = true)]
        public KeyValueEntity? OrgType { get; set; }

    }
}